package user

import (
	"github.com/alecthomas/log4go"
	"pac/proto"
)

func init() {
	registerPbMsgAndProcessor(pb.Cmd_HEARTBEAT, Req, (*pb.HeartbeatReq)(nil), procHeartbeat)
	registerPbMsgAndProcessor(pb.Cmd_HEARTBEAT, Rsp, (*pb.HeartbeatRsp)(nil), nil)
}

func procHeartbeat(cli *Client, pkt *Packet) {
	err := cli.SendRsp(
		pkt.Seq,
		&pb.HeartbeatRsp{
			ErrCode: pb.ErrCode_SUCCESS,
		},
	)
	if err != nil {
		log4go.Error(err)
	}
}
